function checkuse() {
        var check;
        var partten =   /^[a-zA-Z0-9_-]{6,18}$/;
        var username = document.getElementById("username").value;
        if (username.length>18 || username.length<6){
            document.getElementById("ulbl").innerHTML = "必须为6-18位之间！";
            check = false;
        }
        else if(!partten.test(username)){
            document.getElementById("ulbl").innerHTML = "必须由数字和字母组成！";
            check = false;
        }else {
        	document.getElementById("ulbl").innerHTML = "";
            check = true;
        }
        return check;
    }
    function checkpwd() {
        var check;
        var pass = document.getElementById("password").value;
        var pattern = /^[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,18}$/;
        if(pass.length<6 ||pass.length>18 ){
            document.getElementById("plbl").innerHTML = "密码为6-18位间";
            check = false;
        }
        if(!pattern.test(pass)){
            document.getElementById("plbl").innerHTML = "密码不符合要求";
            check = false;
        }else {
        	document.getElementById("plbl").innerHTML = "";
            check = true;

        }
        return check;
    }
    function checkpwdc() {
        var check;
        var pass = document.getElementById("password").value;
        var pwdc = document.getElementById("password2").value;

        if(pwdc != pass){
            document.getElementById("plbl2").innerHTML = "两次密码输入不一致";
            check = false;
        }else {
            check = true;
        }
        return check;
    }
    function checkemail() {
        var check;
        var email = document.getElementById("email").value;
        var pattern = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/;
        if(!pattern.test(email)){
            document.getElementById("elbl").innerHTML = "输入邮箱格式错误";
            check = false;
            }

        else {
            check = true;
            document.getElementById("elbl").innerHTML = "";
        }
        return check;
    }
    

  function check() {
      var check = checkuse() && checkpwd() && checkpwdc() && checkemail();
      return check;
  }
    function sub(){
    	var check = checkuse() && checkpwd() && checkpwdc() && checkemail();
    	if(!check){
//////  		document.regist.submit()="登陆.html";
////  		location.href=("登陆.html");
//			window.location.href("登陆.html");
			alert("请填写正确完整注册信息");
			return;
    	}
    	else{
    		return true;
    	}
    }